﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace MeizuSDK.Presentation
{
    /// <summary>
    /// 等待对话框
    /// </summary>
    public static class WaitDialog
    {
        #region DllImport
        [DllImport("MZFCWrapper.dll")]
        private static extern bool CommonDlgMzBeginWaitDlg(IntPtr hwndOwner);

        [DllImport("MZFCWrapper.dll")]
        private static extern bool CommonDlgMzEndWaitDlg();
        #endregion

        /// <summary>
        /// 显示等待对话框
        /// </summary>
        /// <param name="owner">父窗口</param>
        public static void Begin(IMzWindow owner)
        {
            IMzWindow pOwner = Application.MainWindow;

            if(owner!=null)
            {
                pOwner = owner;
            }

            CommonDlgMzBeginWaitDlg(pOwner == null ? IntPtr.Zero : pOwner.HWnd);
        }
        /// <summary>
        /// 关闭等待对话框
        /// </summary>
        public static void End()
        {
            CommonDlgMzEndWaitDlg();
        }
    }
}
